{block name="style"}
<style>
    .keys-container .input-group-addon {
        top: 0;
        right: 0;
        color: #eee;
        width: 25px;
        padding: 7px;
        position: absolute;
        margin-top: -1px;
        text-align: center;
        background: #393D49
    }

    .keys-container [data-tips-image] {
        width: 112px;
        height: auto
    }

    .keys-container .layui-card {
        width: 580px;
        height: 578px;
        position: absolute;
        border: 1px solid #ccc
    }
</style>
{/block}

<form class="layui-form layui-card keys-container" style="height: 800px;overflow: scroll;" action="{:request()->url()}" data-auto="true" method="post" autocomplete="off">

    <div class="layui-card-body">
        <div class="layui-form-item">
            <label class="layui-form-label">产品名字</label>
            <div class="layui-input-block">
                <input name="act" value='{$vo.act_name|default=""}' required placeholder="请输入产品名字" class="layui-input">
                <p class="help-block">必填，请输入产品名字</p>
            </div>
        </div>

        <div class="layui-form-item">
            <label class="layui-form-label">产品介绍</label>
            <div class="layui-input-block">
                <input name="intro" value='{$vo.intro|default=""}' required placeholder="请输入产品名字" class="layui-input">
                <p class="help-block">必填，请输入产品介绍</p>
            </div>
        </div>

        <div class="layui-form-item">
            <label class="layui-form-label">是否是多属性</label>
            <div class="layui-input-block">
                <input type="radio" name="is_set_attr" value="0" title="否" checked="" lay-filter="is_set_attr">
                <input type="radio" name="is_set_attr" value="1" title="是" lay-filter="is_set_attr">
            </div>
        </div>

        <div class="layui-form-item no_attr_tips">
            <label class="layui-form-label">产品规格</label>
            <div class="layui-input-block">
                <input name="pro_spec" value='{$vo.pro_spec|default=""}' required placeholder="请输入产品名字" class="layui-input">
                <p class="help-block">必填，请输入产品规格 例:3千克/箱</p>
            </div>
        </div>

        <div class="layui-form-item no_attr_tips">
            <label class="layui-form-label">产品图片</label>
            <div class="layui-input-block">
                <input type="hidden" data-uptype="alioss" name="img_url" value="{$vo.img_url|default=''}">
                <script>$('[name=img_url]').uploadOneImage()</script>
                <p class="help-block">必填，上传产品图片</p>
            </div>
        </div>

        <div class="layui-form-item no_attr_tips">
            <label class="layui-form-label">拼团价</label>
            <div class="layui-input-block">
                <input name="group_price" value='{$vo.group_price|default=""}' required placeholder="请输入拼团价" class="layui-input">
                <p class="help-block">必填，请输入拼团价</p>
            </div>
        </div>

        <div class="layui-form-item no_attr_tips">
            <label class="layui-form-label">市场价</label>
            <div class="layui-input-block">
                <input name="market_price" value='{$vo.market_price|default=""}' required placeholder="请输入市场价" class="layui-input">
                <p class="help-block">必填，请输入市场价</p>
            </div>
        </div>

        <div class="layui-form-item">
            <label class="layui-form-label">成团人数</label>
            <div class="layui-input-block">
                <input name="limit_num" value='{$vo.limit_num|default="0"}' required placeholder="请输入限购数量" class="layui-input">
                <p class="help-block">必填，请输入成团人数</p>
            </div>
        </div>

        <div class="layui-form-item no_attr_tips">
            <label class="layui-form-label">库存数量</label>
            <div class="layui-input-block">
                <input name="limit_num" value='{$vo.stock_num|default="0"}' required placeholder="请输入限购数量" class="layui-input">
                <p class="help-block">必填，请输入库存数量</p>
            </div>
        </div>

        <div class="layui-form-item no_attr_tips">
            <label class="layui-form-label">积分数量限制</label>
            <div class="layui-input-block">
                <input name="score_limit" value='{$vo.score_limit|default="0"}' required placeholder="请输入积分数量限制" class="layui-input">
                <p class="help-block">必填，请输入最多可以使用积分数</p>
            </div>
        </div>

        <div class="layui-form-item" data-keys-type='video'>
            <label class="layui-form-label">上传视频</label>
            <div class="layui-input-block">
                <div class="input-group">
                    <input class='layui-input' value="{$vo.video_url|default=''}" name="video_url" required
                           title="请上传视频或输入音乐视频URL地址">
                    <a data-file="btn" data-type="mp4" data-field="video_url" class="input-group-addon"><i
                            class="layui-icon layui-icon-upload"></i></a>
                </div>
                <p class="help-block">文件最大10MB，只支持MP4格式</p>
            </div>
        </div>

        <div class="layui-form-item label-required-prev">
            <label class="layui-form-label">产品详情</label>
            <div class="layui-input-block">
                <textarea name='content' required>{$vo.content|default=''}</textarea>
            </div>
        </div>

    </div>

    <div class="hr-line-dashed"></div>
    <input type='hidden' value='{$vo.times_id}' name='times_id'>
    <input type='hidden' value='{$vo.group_status}' name='group_status'>
    {notempty name='vo.id'}<input type='hidden' value='{$vo.id}' name='id'>{/notempty}

    <div class="layui-form-item text-center">
        <button class="layui-btn" type='submit'>保存数据</button>
        <button class="layui-btn layui-btn-danger" type='button' data-confirm="确定要取消编辑吗？" data-close>取消编辑</button>
    </div>

</form>

{block name='script'}
<script>
    layui.form.render();
    require(['ckeditor', 'angular'], function () {
        window.createEditor('[name="content"]', {height: 280});
    });

    layui.use(['form', 'element', 'laydate'], function () {
        var form = layui.form;
        form.on("radio(is_set_attr)", function (data) {
            console.log(data)
            if (data.value == 0) {
                $('.no_attr_tips').show();
            } else if (data.value == 1) {
                $('.no_attr_tips').hide();
            }
        });
    });

</script>
{/block}
